package com.yizhuoyan.his.webapi.controller.doctor.outpatient;

import com.yizhuoyan.his.ao.DisposalRecordAo;
import com.yizhuoyan.his.dto.JSONResponse;
import com.yizhuoyan.his.service.doctor.outpatient.DisposalApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 处置申请controller
 * author:ZJH
 */
@RestController
public class DisposalApplyController {
    @Autowired
    DisposalApplyService disposalApplyService;

    @PostMapping("/api/temporary-record")
    public ResponseEntity<JSONResponse> addDisposalRecordTemporary(DisposalRecordAo ao) throws Exception {
        disposalApplyService.addDisposalRecordTemporary(ao);
        return ResponseEntity.ok(JSONResponse.ok());
    }

    @PostMapping("/api/open-record/{doctorId}")
    public ResponseEntity<JSONResponse> addDisposalRecordOpen(@PathVariable Long doctorId, DisposalRecordAo ao) throws Exception {
        disposalApplyService.addDisposalRecordOpen(doctorId, ao);
        return ResponseEntity.ok(JSONResponse.ok());
    }

    @DeleteMapping("/api/remove-record/{id}")
    public ResponseEntity<JSONResponse> removeDisposalRecord(@PathVariable Long id) throws Exception {
        disposalApplyService.removeDisposalRecord(id);
        return ResponseEntity.ok(JSONResponse.ok());
    }

    @PutMapping("/api/nullify-record/{id}")
    public ResponseEntity<JSONResponse> nullifyDisposalRecord(@PathVariable Long id) throws Exception {
        disposalApplyService.nullifyDisposalRecord(id);
        return ResponseEntity.ok(JSONResponse.ok());
    }
}
